home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 30
/
PC Gamer IT CD 30 1-2.iso
/
MOTS
/
GAMEDATA
/
RESOURCE
/
JKMRES.GOO
/
cog_weap_blastech_m.cog
< prev
next >
Wrap
Text File
|
1998-02-25
|
8KB
|
280 lines
# Jedi Knight Missions Cog Script
#
# WEAP_BLASTECH_M.COG
#
# WEAPON 12 Script - Blastech Pistol
#
# Mara's signature weapon.
#
# - Affected by MagSealed sectors/surfaces.
#
# [YB & CYW] + [RF]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
symbols
model povModel=blsv.3do local
model povModel_m=blsv_m.3do local
model weaponMesh=blsg.3do local
keyframe mountAnim=blsvmnt.key local
keyframe dismountAnim=blsvdis.key local
keyframe povfireAnim=blsvpst1.key local
keyframe holsterAnim=kyhlstr.key local
sound outSound=pistout1.wav local
sound mountSound=df_bry_ready.wav local
sound dismountSound=PutWeaponAway01.wav local
sound fireSound=hsblaster.wav local
#sound chargeSound=scalarm.wav local
sound chargeSound=BCChargeUp.wav local
sound failSound=weapfail.wav local
template projectile=+bryarbolt local
template projectileB=+swsparks local
thing player local
thing victim local
thing potential local
flex dot local
flex maxDot local
flex fireWait=0.5 local
flex holsterWait local
flex fireDelay=0.6 local
flex powerBoost local
flex autoAimFOV=30 local
flex autoAimMaxDist=5 local
int weaponIndex local
int trackID=-1 local
int dummy=0 local
int mode local
int holsterTrack local
int i local
int iBlastSize local
int powerChannel local
vector vFire local
message activated
message deactivated
message selected
message deselected
message autoselect
message fire
message timer
end
# ========================================================================================
code
fire:
player = GetSourceRef();
// Check that the player is still alive.
if(GetThingHealth(player) <= 0)
Return;
if (mode == 1)
{
if ((GetInv(player, 11) >= 1.0) && (iBlastSize < 4))
{
ChangeInv(player, 11, -1.0);
iBlastSize = iBlastsize + 1;
dot = 0.80 + iBlastSize * 0.20;
powerChannel = PlaySoundThing(chargeSound, player, 1.0, -1.0, -1.0, 0x80);
ChangeSoundPitch(powerChannel, dot, 0.0);
}
return;
}
// Check Ammo - If we are out, autoselect best weapon.
if(GetInv(player, 11) < 1.0)
{
PlaySoundThing(outSound, player, 1.0, -1.0, -1.0, 0x80);
if(GetAutoSwitch() & 1)
SelectWeapon(player, GetWeaponBin(AutoSelectWeapon(player, 1)));
Return;
}
SendMessageEx(GetThingClassCog(GetLocalPlayerThing()), user1, 3.0, 0, 0, 0);
SetPOVShake('0.0 -.003 0.0', '1.0 0.0 0.0', .05, 80.0);
if (GetInv(player, 93) > 0.0)
{
dummy = FireProjectile(player, projectileB, failSound, 8, '0.0135 0.1624 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2);
}
else
dummy = FireProjectile(player, projectile, fireSound, 8, '0.0135 0.1624 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2);
ChangeInv(player, 11, -1.0);
jkPlayPOVKey(player, povfireAnim, 1, 0x38);
powerBoost = GetInv(player, 63);
ChangeFireRate(player, fireWait/powerBoost);
Return;
# ........................................................................................
activated:
player = GetSourceRef();
mode = GetSenderRef();
if (GetInv(player, 93) > 0.0)
{
SendMessageEx(GetThingClassCog(player), skill, 1100, 0, 0, 0);
mode = 0;
}
iBlastSize = 0;
jkSetWaggle(player, '0.0 0.0 0.0', 0);
powerBoost = GetInv(player, 63);
ActivateWeapon( player, (fireWait/powerBoost) * (1.0+(mode/2)), mode );
Return;
# ........................................................................................
deactivated:
player = GetSourceRef();
mode = GetSenderRef();
if (GetInv(player, 93) > 0.0)
mode = 0;
jkSetWaggle(player, '10.0 7.0 0.0', 350);
DeactivateWeapon( player, mode );
if (mode == 1)
{
// Always shoot at least 1 shot (if possible)
if (iBlastSize == 0)
{
if (GetInv(player, 11) >= 1.0)
{
ChangeInv(player, 11, -1.0);
iBlastSize = 1;
}
else
{
return;
}
}
i = iBlastSize;
iBlastSize = 0;
SendMessageEx(GetThingClassCog(GetLocalPlayerThing()), user1, 3.0, 0, 0, 0);
while (i > 0)
{
i = i - 1;
vFire = VectorSet(0.0135, 0.1624+(i*0.01), 0);
FireProjectile(player, projectile, fireSound, 8, vFire, '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2);
}
// Check Ammo - If we are out, autoselect best weapon.
if(GetInv(player, 11) < 1.0)
{
PlaySoundThing(outSound, player, 1.0, -1.0, -1.0, 0x80);
if(GetAutoSwitch() & 1)
SelectWeapon(player, GetWeaponBin(AutoSelectWeapon(player, 1)));
Return;
}
}
Return;
# ........................................................................................
selected:
player = GetSourceRef();
// Setup the meshes and models.
if (GetInv(player, 67) == 0.0)
jkSetPOVModel(player, povModel); // Kyle hand
else
jkSetPOVModel(player, povModel_m); // Mara Hand
jkSetWeaponMesh(player, weaponMesh);
SetArmedMode(player, 1);
// Play mounting sound.
PlayMode(player, 41);
PlaySoundThing(mountSound, player, 1.0, -1.0, -1.0, 0x80);
// Play the animation (NOLOOP + UNIQUE + ENDPAUSE).
// The animation is held at the last frame after it is played.
trackID = jkPlayPOVKey(player, mountAnim, 0, 0x14);
jkSetWaggle(player, '10.0 7.0 0.0', 350);
// Clear saber flags, and allow activation of the weapon
jkClearFlags(player, 0x5);
SetCurWeapon(player, GetWeaponBin(12));
SetMountWait(player, GetKeyLen(mountAnim));
Return;
# ........................................................................................
deselected:
player = GetSourceRef();
weaponIndex = GetSenderRef();
PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);
jkPlayPOVKey(player, dismountAnim, 0, 18);
holsterWait = GetKeyLen(holsterAnim);
SetMountWait(player, holsterWait);
holsterTrack = PlayKey(player, holsterAnim, 1, 0x4);
SetTimerEx(holsterWait, 2, 0.0, 0.0);
if (trackID != -1)
{
jkStopPOVKey(player, trackID, 0);
trackID = -1;
}
jkSetWaggle(player, '0.0 0.0 0.0', 0);
Return;
# ........................................................................................
autoselect:
player = GetSourceRef();
// If the player has the weapon
if(GetInv(player, GetWeaponBin(12)) != 0.0)
{
// If the player has ammo
if(GetInv(player, 11) != 0.0)
{
ReturnEx(500.0);
}
else
{
ReturnEx(-1.0);
}
}
else
{
ReturnEx(-1.0);
}
Return;
# ........................................................................................
timer:
StopKey(player, holsterTrack, 0.0);
Return;
end